package com.ug.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ug.common.constant.SecurityConstants;
import com.ug.common.response.ResponseMessage;
import com.ug.common.response.ResponseMessageFactory;
import com.ug.system.entity.SysLoginLog;
import com.ug.system.entity.dto.QueryDto;
import com.ug.system.entity.dto.SysLoginLogDto;
import com.ug.system.service.SysLoginLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author LY
 * @create 2024/8/30 10:46
 * @Description 登录日志
 */
@Tag(name = "SysLogController", description = "登录日志管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/sys/log")
public class SysLoginLogController {

    private final SysLoginLogService sysLoginLogService;

    /**
     * 查询日志列表
     * @param queryDto 请求查询信息入参
     * @param sysLoginLogDto 请求日志类dto
     */
    @Operation(summary = "登录日志列表", security = { @SecurityRequirement(name = SecurityConstants.TOKEN_HEADER) })
    @GetMapping("/loginLogList")
    public ResponseMessage<IPage<SysLoginLog>> getLoginLogList(QueryDto queryDto, SysLoginLogDto sysLoginLogDto){
        return ResponseMessageFactory.getSuccessResponseMessage(sysLoginLogService.getLoginLogList(queryDto, sysLoginLogDto));
    }
}
